package net.cyndeline.temporary

import com.escalatesoft.subcut.inject.BindingModule
import com.escalatesoft.subcut.inject.Injectable
import net.cyndeline.entitySystem.EventSystemSetup
import net.cyndeline.entitySystem.EventSystem

/**
 * Used to enable DI since Javafx can't instantiate the
 * top object with binding module.
 */
class TempDataHolder(implicit val bindingModule: BindingModule) extends Injectable {
  
  def run {
    val systemSetup = injectOptional[EventSystemSetup] getOrElse new TempSystemSetup()
    val eventSystem = inject[EventSystem]
    eventSystem.setup(systemSetup)
  }
  
  def process {
    val eventSystem = inject[EventSystem]
    eventSystem.process
  }
}